const path = require("path")
const htmlWebpackPlugin = require("html-webpack-plugin")
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const webpack = require("webpack")

module.exports = {
    mode: "none",
    entry: "./src/main.js",
    output: {
        filename: "bundle.js",
        path: path.join(__dirname,"dist"),
    },
    devServer:{
        hotOnly: true
    },
    module: {
      rules: [
        //js
        {
            test: /\.js$/, 
            use: {
                loader: 'babel-loader',
                options: {
                    presets: ["@babel/preset-env"]
                }
                
            }
        },
        //js
        {
            test: /\.js$/, 
            exclude:/node_modules/,
            use: "eslint-loader",
            enforce: "pre"
        },
        //less
        {test: /\.less$/, use: ['style-loader', 'css-loader', 'less-loader']},
        //css
        {test: /\.css$/, use: ['style-loader', 'css-loader']},
        //vue
        {test: /\.vue$/, use: "vue-loader"},
        //images
        {test: /\.png$/, use: {
            loader: 'url-loader',
            options: {
              outputPath: 'imgs/',
              limit: 10*1024
            }
          }},
      ]
    },
    plugins:[
        new webpack.HotModuleReplacementPlugin(),
        new htmlWebpackPlugin({
            title: "首页",
            template: './public/index.html'
        }),
        new VueLoaderPlugin()
    ]
}